package com.nbicc.dp.web.wspanel.dtoservice;

import com.nbicc.core.common.ResponseUtil;
import com.nbicc.dp.wsgateway.common.WsPush;
import com.nbicc.dp.wsgateway.iservice.IWsPanelService;
import com.nbicc.dp.wsgateway.model.WsPanel;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.ui.ModelMap;

import javax.annotation.Resource;
import java.util.Date;
import java.util.Map;

/**
 * @Author: lilingyan
 */
@Service
public class WsPanelDtoService {

    @Resource(name = "WsPanelService")
    private IWsPanelService wsPanelService;

    public ResponseEntity<ModelMap> listAllOnlinePanel() {
        Map<String, WsPanel> stringWsPanelMap = wsPanelService.listAllOnlinePanel();
        return ResponseUtil.ok(stringWsPanelMap);
    }

    public ResponseEntity<ModelMap> pushMsgToPanel(WsPush wsPush) {
        wsPush.setDate(new Date());
        wsPanelService.pushMsgToPanel(wsPush);
        return ResponseUtil.ok();
    }
}
